import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    redirect:'/personal',
    component: () => import('../views/Home.vue'),
    meta: { 'title': '首页' },
    children: [{
      path: '/personal',
      name: 'Personal',
      component: () => import('../pages/personal/main.vue'),
      meta: { 'title': '个人文件' }
    },{
      path: '/department',
      name: 'Department',
      component: () => import('../pages/department/main.vue'),
      meta: { 'title': '部门文件' }
    },{
      path: '/company',
      name: 'Company',
      component: () => import('../pages/company/main.vue'),
      meta: { 'title': '公司文件' }
    },{
      path: '/collection',
      name: 'Collection',
      component: () => import('../pages/collection/main.vue'),
      meta: { 'title': '收藏夹' }
    },{
      path: '/share',
      name: 'Share',
      component: () => import('../pages/share/main.vue'),
      meta: { 'title': '我的分享' }
    },{
      path: '/recycle',
      name: 'Recycle',
      component: () => import('../pages/recycle/main.vue'),
      meta: { 'title': '回收站' }
    },]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

//路由拦截器拦截手动输入的url地址

export default router
